home *** CD-ROM | disk | FTP | other *** search
/ A.C.E. 2 / ACE CD 2.iso / FILES / UTILS / AMOSPRO4.DMS / in.adf / Tutorials / Menus / Menus_4.AMOS / Menus_4.amosSourceCode
Encoding:
AMOS Source Code  |  1992-09-28  |  4.0 KB  |  132 lines

  1. '*************************** 
  2. '*    AMOS Professional    * 
  3. '*                         * 
  4. '*         MENUS 4         * 
  5. '*                         *               Keyboard shortcuts
  6. '* (c) Europress Software  *                      and
  7. '*                         *              Deleting menu items
  8. '*     Ronnie Simpson      * 
  9. '*************************** 
  10. '
  11. '------------------------------------------- 
  12. 'KEYBOARD SHORTCUTS
  13. '------------------------------------------- 
  14. 'Using the Menu Key instruction
  15. '
  16. 'Keyboard shortcuts can be assigned to any of the base level menu options but
  17. 'NOT to any of the sub-options.
  18. 'Either a string containing a single character or the internal scancode
  19. 'number can be used to assign the menu items to the keyboard for example:- 
  20. '
  21. '         Menu Key(1,1) To "a" (lower case single character) 
  22. '         Menu Key(2,1) To "B" (Upper case would require a key shift)  
  23. '         Menu Key(2,2) To 95  (scancode 95 is the help key) 
  24. '
  25. 'Another optional parameter can also be added to test for the control  
  26. 'keys, the status of these keys are held in a bit-map in the same format 
  27. 'as the Key Shift function.
  28. '
  29. 'eg.      Menu Key(1,1) to 80,%00001000  
  30. '
  31. 'If more than 1 bit is set then all the appropriate keys will have to be 
  32. 'held down together for the menu item to be called.
  33. '            (See Key Shift instruction for more details)  
  34. '
  35. 'A keyboard shortcut can be turned off by using Key Shift without any
  36. 'perameters.         eg.  Menu Key (1,1) 
  37. '
  38. '------------------------------------------- 
  39. 'DELETING MENU ITEMS 
  40. '------------------------------------------- 
  41. 'To erase all or part of your menu the instruction Menu Del is used. 
  42. '
  43. 'Without any parameters Menu Del erases the entire menu and returns the  
  44. 'memory to the system. 
  45. '
  46. 'By adding in the normal format you can erase any single item:-
  47. '
  48. '      Menu Del (2,1)    (erase option 2 from title 1) 
  49. '      Menu Del (3)      (erase title 3) 
  50. '
  51. '------------------------------------------- 
  52. 'WORKING EXAMPLE 
  53. '------------------------------------------- 
  54. Dim T$(5)
  55. '
  56. Rem *** tidy up the screen 
  57. '
  58. Screen Open 0,640,200,16,Hires
  59. Palette $0,$F00,$F0,$F,$FF0,$F0F,$FF,$EE7,$7F,$70F,$F07,$5F7,$F75,$57F,$CCC,$FFF
  60. Flash Off : Curs Off : Cls 0 : Pen 0 : Paper 7 : Ink 14,0
  61. '
  62. Rem *** set the menu titles
  63. '
  64. Menu$(1)="   CONTROL     "
  65. Menu$(2)="   POINTER SHAPE     "
  66. Menu$(3)="   COLOURS   "
  67. '
  68. Rem *** set the options
  69. '
  70. Menu$(1,1)="    QUIT      "
  71. '
  72. Menu$(2,1)="    POINTER        "
  73. Menu$(2,2)="    CROSS-HAIRS    "
  74. Menu$(2,3)="    CLOCK          "
  75. '
  76. Menu$(3,1)="   RED       " : Menu Key(3,1) To "1"
  77. Menu$(3,2)="   GREEN     " : Menu Key(3,2) To "2"
  78. Menu$(3,3)="   BLUE      " : Menu Key(3,3) To "3"
  79. Menu$(3,4)="   YELLOW    " : Menu Key(3,4) To "4"
  80. Menu$(3,5)="   MAGENTA   " : Menu Key(3,5) To "5"
  81. Menu$(3,6)="   CYAN      " : Menu Key(3,6) To "6"
  82. T$(1)="Press right mouse key to see the menu."
  83. T$(2)="Menu control is now independant of the main program."
  84. T$(3)="Each title has its own procedure."
  85. T$(4)="On Menu avoids using too many If...Then statements."
  86. T$(5)="Select CONTROL/QUIT from the menu to return to the editor."
  87. '
  88. Menu Key(1,1) To "q"
  89. Menu Key(2,1) To "p"
  90. Menu Key(2,2) To "x"
  91. Menu Key(2,3) To "c"
  92. '
  93. Rem *** start the automatic checking 
  94. '
  95. Menu On 
  96. On Menu Proc CONTROL,MOUSE,KOLOURS
  97. On Menu On 
  98. '
  99. Pen 12 : Paper 0
  100. Locate 0,13 : Centre "Keyboard shortcuts introduced to change options"
  101. Pen 13 : Locate 21,15 : Print "CONTROL      POINTER SHAPE     COLOURS"
  102. Pen 11 : Locate 21,17 : Print "q=Quit       p=pointer         1-RED"
  103. Locate 34,18 : Print "x=crosshairs      2-GREEN"
  104. Locate 34,19 : Print "c=clock           3-BLUE"
  105. Locate 52,20 : Print "4-YELLOW"
  106. Locate 52,21 : Print "5-MAGENTA"
  107. Locate 52,22 : Print "6-CYAN"
  108. '
  109. Rem *** loop whilst waiting for menu 
  110. '
  111. Do 
  112.    Add COUNT,1,1 To 3000
  113.    If COUNT=500
  114.       Add N,1,1 To 5
  115.       Text 100,N*12+22,T$(N)
  116.    End If 
  117. Loop 
  118. '
  119. Procedure CONTROL
  120.    Edit 
  121. End Proc
  122. '
  123. Procedure MOUSE
  124.    Change Mouse Choice(2)
  125.    On Menu On 
  126. End Proc
  127. '
  128. Procedure KOLOURS
  129.    Shared T$()
  130.    Ink Choice(2),0
  131.    On Menu On 
  132. End Proc